package com.ayou.eggguard.farm.mapper;

import com.ayou.eggguard.farm.pojo.Drug;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface DrugMapper {
    List<Drug> getDrugs(String drugNumber);

    @Insert("insert into drug(drug_number, drug_name, drug_specification, drug_firm, drug_use) " +
            "values(#{drugNumber},#{drugName},#{drugSpecification},#{drugFirm},#{drugUse})")
    void add(Drug drug);

    @Update("update drug set drug_number=#{drugNumber},drug_name=#{drugName},drug_specification=#{drugSpecification}," +
            "drug_firm=#{drugFirm},drug_use=#{drugUse} where id=#{id}")
    void update(Drug drug);

    @Delete("delete from drug where id=#{id}")
    void delete(Integer id);
}
